home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / clarion / cw15 / tpw15.z / FIELD.TPW < prev    next >
Text File  |  1995-09-06  |  10KB  |  281 lines

  1. #!------------------------------------------------------------------------------
  2. #GROUP(%FieldTemplateStandardButtonMenuPrompt)
  3. #FIELD WHERE(%ControlType = 'BUTTON' OR (%ControlType = 'ITEM' AND NOT EXTRACT(%ControlStatement,'SEPARATOR')))
  4.   #BOXED('Menu/Button Control Prompts')
  5.     #PROMPT('When Pressed',DROP('No Special Action|Call a Procedure|Run a Program')),%ButtonAction,DEFAULT('No Special Action')
  6.     #DISPLAY('')
  7.     #BOXED('Program Definition'),WHERE(%ButtonAction = 'Run a Program'),AT(,20),CLEAR
  8.       #PROMPT('Program Name:',@S40),%ButtonRunName,REQ
  9.       #PROMPT('Parameters:',@s255),%ButtonRunParameters
  10.     #ENDBOXED
  11.     #BOXED('Procedure Definition'),WHERE(%ButtonAction = 'Call a Procedure'),AT(,20)
  12.       #ENABLE(%ButtonAction = 'Call a Procedure'),CLEAR
  13.         #PROMPT('Procedure Name:',PROCEDURE),%ButtonProcedure,REQ
  14.         #PROMPT('Initiate Thread',CHECK),%ButtonThread
  15.       #ENDENABLE
  16.       #ENABLE(%ButtonThread = %True)
  17.         #PROMPT('Thread Stack:',SPIN(@n7,5000,64000,500)),%ButtonThreadStack,DEFAULT(25000)
  18.       #ENDENABLE
  19.       #ENABLE(%ButtonThread = %False),CLEAR
  20.         #PROMPT('Parameters:',@s255),%ButtonParameters
  21.         #PROMPT('Requested File Action:',DROP('None|Insert|Change|Delete|Select')),%ButtonRequest,DEFAULT('None')
  22.       #ENDENABLE
  23.     #ENDBOXED
  24.   #ENDBOXED
  25. #ENDFIELD
  26. #!------------------------------------------------------------------------------
  27. #GROUP(%FieldTemplateStandardButtonMenuHandling)
  28. #IF(%ControlEvent = 'Accepted')
  29. DO SyncWindow
  30.   #IF(%ButtonAction = 'Call a Procedure')
  31.     #IF(%ButtonProcedure)
  32.       #IF(%ButtonThread)
  33. START(%ButtonProcedure,%ButtonThreadStack)
  34.       #ELSE
  35.         #IF(%ButtonRequest AND %ButtonRequest <> 'None')
  36.           #SET(%ValueConstruct,%ButtonRequest & 'Record')
  37. GlobalRequest = %ValueConstruct
  38.         #ENDIF
  39. %ButtonProcedure %ButtonParameters
  40.       #ENDIF
  41.     #ENDIF
  42. LocalRequest = OriginalRequest
  43. DO RefreshWindow
  44.   #ELSIF(%ButtonAction = 'Run a Program')
  45. RUN('%ButtonRunName %ButtonRunParameters')
  46. ForceRefresh = True
  47. LocalRequest = OriginalRequest
  48. DO RefreshWindow
  49.   #ENDIF
  50. #ENDIF
  51. #!------------------------------------------------------------------------------
  52. #GROUP(%FieldTemplateStandardEntryPrompt)
  53. #FIELD WHERE(%ControlType = 'ENTRY')
  54.   #BOXED('Entry Control Prompts')
  55.     #BOXED('When the Control Is Selected')
  56.       #PROMPT('Lookup Key',KEY),%PreLookupKey
  57.       #ENABLE(%PreLookupKey),CLEAR
  58.         #PROMPT('Lookup Field',COMPONENT(%PreLookupKey)),%PreLookupField,REQ
  59.         #PROMPT('Lookup Procedure',PROCEDURE),%PreLookupProcedure,REQ
  60.       #ENDENABLE
  61.       #PROMPT('Advanced...',EMBEDBUTTON(%ControlPostEventHandling,%Control,'Selected')),AT(100)
  62.     #ENDBOXED
  63.     #BOXED('When the Control Is Accepted')
  64.       #PROMPT('Lookup Key',KEY),%PostLookupKey
  65.       #ENABLE(%PostLookupKey),CLEAR
  66.         #PROMPT('Lookup Field',COMPONENT(%PostLookupKey)),%PostLookupField,REQ
  67.         #PROMPT('Lookup Procedure',PROCEDURE),%PostLookupProcedure,REQ
  68.         #PROMPT('Perform Lookup during Non-Stop Select',CHECK),%PostLookupDuringValidate,DEFAULT(1),AT(10,,180)
  69.       #ENDENABLE
  70.       #PROMPT('Advanced...',EMBEDBUTTON(%ControlPostEventHandling,%Control,'Accepted')),AT(100)
  71.     #ENDBOXED
  72.     #PROMPT('Force Window Refresh when Accepted',CHECK),%ForceWindowRefresh,AT(20,,160)
  73.   #ENDBOXED
  74. #ENDFIELD
  75. #!------------------------------------------------------------------------------
  76. #GROUP(%FieldTemplateStandardEntryHandling),AUTO
  77. #CASE(%ControlEvent)
  78. #OF('Selected')
  79.   #IF(%PreLookupKey)
  80.     #FIND(%Field,%ControlUse)
  81.     #FOR(%Relation),WHERE(%RelationKey = %PreLookupKey)
  82.       #IF(%FileRelationType = 'MANY:1')
  83.         #FOR(%FileKeyField),WHERE(%FileKeyFieldLink)
  84.           #IF(%FileKeyFieldLink = %PreLookupField)
  85.             #BREAK
  86.           #ENDIF
  87. %FileKeyFieldLink = %FileKeyField
  88.         #ENDFOR
  89.       #ENDIF
  90.     #ENDFOR
  91.     #FIND(%Key,%PreLookupKey)
  92.     #IF(%Key)
  93. %PreLookupField = %ControlUse
  94. GET(%File,%Key)
  95. IF ERRORCODE()
  96.   GlobalRequest = SelectRecord
  97.   %PreLookupProcedure
  98.   LocalResponse = GlobalResponse
  99.   IF LocalResponse = RequestCompleted
  100.     #FIND(%Field,%ControlUse)
  101.     #FOR(%Relation),WHERE(%RelationKey = %PreLookupKey)
  102.       #IF(%FileRelationType = 'MANY:1')
  103.         #FOR(%FileKeyField),WHERE(%FileKeyFieldLink)
  104.           #IF(%FileKeyFieldLink = %PreLookupField)
  105.             #BREAK
  106.           #ENDIF
  107.     %FileKeyField = %FileKeyFieldLink
  108.         #ENDFOR
  109.       #ENDIF
  110.     #ENDFOR
  111.     %ControlUse = %PreLookupField
  112.   END
  113. END
  114. LocalRequest = OriginalRequest
  115. DO RefreshWindow
  116.     #ENDIF
  117.   #ENDIF
  118. #OF('Accepted')
  119.   #IF(%PostLookupKey)
  120.     #FIND(%Key,%PostLookupKey)
  121.     #IF(%Key)
  122.       #FIND(%Field,%ControlUse)
  123.       #IF(%PostLookupDuringValidate)
  124.         #IF(%FieldLookup)
  125. #INSERT(%GeneratePostLookupFieldCode)
  126.         #ELSE
  127. IF %ControlUse OR %Control{Prop:Req}
  128.   #INSERT(%GeneratePostLookupFieldCode)
  129. END
  130.         #ENDIF
  131.       #ELSE
  132. IF %Window{Prop:AcceptAll} = False
  133.         #IF(%FieldLookup)
  134.   #INSERT(%GeneratePostLookupFieldCode)
  135.         #ELSE
  136.   IF %ControlUse OR %Control{Prop:Req}
  137.     #INSERT(%GeneratePostLookupFieldCode)
  138.   END
  139.         #ENDIF
  140. END
  141.       #ENDIF
  142.       #IF(%ForceWindowRefresh)
  143. ForceRefresh = True
  144.       #ENDIF
  145. LocalRequest = OriginalRequest
  146. DO RefreshWindow
  147.     #ELSIF(%ForceWindowRefresh)
  148. ForceRefresh = True
  149. LocalRequest = OriginalRequest
  150. DO RefreshWindow
  151.     #ENDIF
  152.   #ELSIF(%ForceWindowRefresh)
  153. ForceRefresh = True
  154. LocalRequest = OriginalRequest
  155. DO RefreshWindow
  156.   #ENDIF
  157. #ENDCASE
  158. #!------------------------------------------------------------------------------
  159. #GROUP(%GeneratePostLookupFieldCode)
  160.   #FOR(%Relation),WHERE(%RelationKey = %PostLookupKey)
  161.     #IF(%FileRelationType = 'MANY:1')
  162.       #FOR(%FileKeyField),WHERE(%FileKeyFieldLink)
  163.         #IF(%FileKeyFieldLink = %PostLookupField)
  164.           #BREAK
  165.         #ENDIF
  166. %FileKeyFieldLink = %FileKeyField
  167.       #ENDFOR
  168.     #ENDIF
  169.   #ENDFOR
  170. %PostLookupField = %ControlUse
  171. #FIND(%Key,%PostLookupKey)
  172. GET(%File,%Key)
  173. IF ERRORCODE()
  174.   GlobalRequest = SelectRecord
  175.   %PostLookupProcedure
  176.   LocalResponse = GlobalResponse
  177.   IF LocalResponse = RequestCompleted
  178.   #FIND(%Field,%ControlUse)
  179.   #FOR(%Relation),WHERE(%RelationKey = %PostLookupKey)
  180.     #IF(%FileRelationType = 'MANY:1')
  181.       #FOR(%FileKeyField),WHERE(%FileKeyFieldLink)
  182.         #IF(%FileKeyFieldLink = %PostLookupField)
  183.           #BREAK
  184.         #ENDIF
  185.     %FileKeyField = %FileKeyFieldLink
  186.       #ENDFOR
  187.     #ENDIF
  188.   #ENDFOR
  189.     %ControlUse = %PostLookupField
  190.   ELSE
  191.     SELECT(%Control)
  192.     CYCLE
  193.   END
  194. END
  195. #!------------------------------------------------------------------------------
  196. #GROUP(%FieldTemplateStandardCheckBoxPrompt)
  197. #FIELD WHERE(%ControlType = 'CHECK')
  198.   #BOXED('Checkbox Control Prompts')
  199.     #BOXED('When the Checkbox is Checked')
  200.       #BUTTON('Assign Values'),MULTI(%CheckedAssigns,%CheckedAssignVariable & ' = ' & %CheckedAssignValue),AT(20,,160),HLP('~TPLFieldCheckBox_CheckedAssignValues')
  201.         #DISPLAY('Values to assign when the check box is checked')
  202.         #DISPLAY('')
  203.         #PROMPT('Variable to Assign',FIELD),%CheckedAssignVariable,REQ
  204.         #PROMPT('Value to Assign',@S40),%CheckedAssignValue,REQ
  205.       #ENDBUTTON
  206.       #BUTTON('Hide/Unhide Controls'),MULTI(%CheckedHides,%CheckedControl & ' - ' & %CheckedControlAction),AT(20,,160),HLP('~TPLFieldCheckBox_CheckedHideUnhide')
  207.         #DISPLAY('Controls to hide/unhide when the check box is checked')
  208.         #DISPLAY('')
  209.         #PROMPT('Control to hide/unhide:',CONTROL),%CheckedControl,REQ
  210.         #PROMPT('Hide or unhide control',DROP('Hide|Unhide')),%CheckedControlAction,REQ
  211.       #ENDBUTTON
  212.     #ENDBOXED
  213.     #BOXED('When the Checkbox is Unchecked')
  214.       #BUTTON('Assign Values'),MULTI(%UncheckedAssigns,%UncheckedAssignVar & ' = ' & %UncheckedAssignValue),AT(20,,160),HLP('~TPLFieldCheckBox_UncheckedAssignValues')
  215.         #DISPLAY('Values to assign when the check box is unchecked')
  216.         #DISPLAY('')
  217.         #PROMPT('Variable to Assign',FIELD),%UncheckedAssignVariable,REQ
  218.         #PROMPT('Value to Assign',@S40),%UncheckedAssignValue,REQ
  219.       #ENDBUTTON
  220.       #BUTTON('Hide/Unhide Controls'),MULTI(%UnCheckedHides,%UnCheckedControl & ' - ' & %UnCheckedControlAction),AT(20,,160),HLP('~TPLFieldCheckBox_UncheckedHideUnhide')
  221.         #DISPLAY('Controls to hide/unhide when the check box is unchecked')
  222.         #DISPLAY('')
  223.         #PROMPT('Control to hide/unhide:',CONTROL),%UnCheckedControl,REQ
  224.         #PROMPT('Hide or unhide control',DROP('Hide|Unhide')),%UnCheckedControlAction,REQ
  225.       #ENDBUTTON
  226.     #ENDBOXED
  227.   #ENDBOXED
  228. #ENDFIELD
  229. #!------------------------------------------------------------------------------
  230. #GROUP(%FieldTemplateStandardCheckBoxHandling)
  231. #IF(%ControlEvent='Accepted')
  232.   #SUSPEND
  233.     #IF(ITEMS(%CheckedAssigns) OR ITEMS(%CheckedHides))
  234. IF %ControlUse
  235.       #FOR(%CheckedAssigns),WHERE(%CheckedAssignVariable)
  236.   %CheckedAssignVariable = %CheckedAssignValue
  237.       #ENDFOR
  238.       #FOR(%CheckedHides)
  239.         #IF(%CheckedControlAction='Hide')
  240.   %CheckedControl{Prop:Hide} = TRUE
  241.         #ELSE
  242.   %CheckedControl{Prop:Hide} = FALSE
  243.         #ENDIF
  244.       #ENDFOR
  245. END
  246.     #ENDIF
  247.     #IF(ITEMS(%UncheckedAssigns) OR ITEMS(%UncheckedHides))
  248. IF ~%ControlUse
  249.       #FOR(%UncheckedAssigns),WHERE(%UncheckedAssignVariable)
  250.   %UncheckedAssignVariable = %UncheckedAssignValue
  251.       #ENDFOR
  252.       #FOR(%UncheckedHides)
  253.         #IF(%UncheckedControlAction='Hide')
  254.   %UncheckedControl{Prop:Hide} = TRUE
  255.         #ELSE
  256.   %UncheckedControl{Prop:Hide} = FALSE
  257.         #ENDIF
  258.       #ENDFOR
  259. END
  260.     #ENDIF
  261. #?DO RefreshWindow
  262.   #RESUME
  263. #ENDIF
  264. #!-------------------------------------------------------------------------
  265. #GROUP(%FieldTemplateStandardHandling)
  266. #CASE(%ControlType)
  267. #OF('BUTTON')
  268. #OROF('ITEM')
  269.   #IF(NOT EXTRACT(%ControlStatement,'SEPARATOR'))
  270. #INSERT(%FieldTemplateStandardButtonMenuHandling)
  271.   #ENDIF
  272. #OF('ENTRY')
  273. #INSERT(%FieldTemplateStandardEntryHandling)
  274. #OF('CHECK')
  275. #INSERT(%FieldTemplateStandardCheckboxHandling)
  276. #OF('BUTTON')
  277. #INSERT(%FieldTemplateStandardButtonMenuHandling)
  278. #OF('SHEET')
  279. DO RefreshWindow
  280. #ENDCASE
  281.